{% extends 'blog/base.html' %}

{% block content %}
    {% for post in posts %}
        <div class="post">
            <div class="date">
                <p>Published: {{ post.published_date }} </p>
            </div>
            <h1><a href="{% url 'post_detail' pk=post.pk %}"> {{ post.title }}</a></h1>
            <p> {{ post.text|truncatewords:30|linebreaksbr}} </p>
            <a href="{% url 'post_detail' pk=post.pk %}">Comments: {{ post.approved_comments.count }}</a>
            <hr>
        </div>
    {% endfor %}
{% endblock %}